<?php
if (!defined('BASEPATH'))
    exit('no direct script allowed asshole!!');
$this->load->helper('html');
?>


<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<script src="<?= base_url() ?>js/jscal2.js"></script>
<script src="<?= base_url() ?>js/lang/en.js"></script>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/border-radius.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/steel/steel.css" />



<div id="container">
    <fieldset class="fieldset">
        <legend class="legend">

		<?
		if ($status == "detail") {
		echo '| Detail Data Pegawai |</legend>';
		} else if ($status == "edit") {
		echo '| Edit Data Pegawai |</legend>';
		}
		else {
		echo '| Form Data Pegawai |</legend>';
		}
		?>

        <div id="contentform" style="border:solid thin #BBBBBB; height:350px; background-color:#F9F9F9; -moz-border-radius: 5px;  padding-top:10px; padding-bottom:0.3px; margin-right:100px; margin-left:100px;">

            <!-- Start value -->
            <?
            //Setting Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
            $value = array(
                'ID_PEGAWAI' => "",
                'NAMA_PEGAWAI' => "",
                'NAMA_PANGGILAN' => "",
                'TEMPAT_LAHIR' => "",
                'TANGGAL_LAHIR' => "",
                'GOLONGAN_DARAH' => "",
                'AGAMA' => "",
                'SUKU' => "",
                'BAHASA_SEHARI' => "",
                'DEPARTEMEN_PEGAWAI' => "",
                'BENGKEL' => "",
                'ALAMAT' => "",
                'TELEPON' => "",
                'STATUS' => "",
                'FOTO_PEGAWAI' => "",
				'act_form' => "pegawai/upload/"
            );

            //Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
            if ($status == "edit") {
				$value['ID_PEGAWAI'] = $ID_PEGAWAI;
                $value['NAMA_PEGAWAI'] = $NAMA_PEGAWAI;
                $value['NAMA_PANGGILAN'] = $NAMA_PANGGILAN;
                $value['TEMPAT_LAHIR'] = $TEMPAT_LAHIR;
                $value['TANGGAL_LAHIR'] = $TANGGAL_LAHIR;
                $value['GOLONGAN_DARAH'] = $GOLONGAN_DARAH;
                $value['AGAMA'] = $AGAMA;
                $value['SUKU'] = $SUKU;
                $value['BAHASA_SEHARI'] = $BAHASA_SEHARI;
                $value['DEPARTEMEN_PEGAWAI'] = $DEPARTEMEN_PEGAWAI;
                $value['BENGKEL'] = $BENGKEL;
                $value['ALAMAT'] = $ALAMAT;
                $value['TELEPON'] = $TELEPON;
                $value['STATUS'] = $STATUS;
                $value['FOTO_PEGAWAI'] = $FOTO_PEGAWAI;
				$value['act_form'] = "pegawai/update/" . $value['ID_PEGAWAI'];
            }//end if
	        ?>

            <?= form_open_multipart($value["act_form"]); ?>
           
            <!-- End value -->

            <table width="847" border="0" bordercolor="#F0F0F0">
                <tr>
                    <td width="905" height="150">
                        <form id="form1" name="form1" method="post">
                            <div align="center">
                                <table width="850" border="0">
									<tr>
                                        <td width="80">Nama Pegawai</td>
                                        <td width="208"><input name="NAMA_PEGAWAI" type="text" size="50" value="<?= $value['NAMA_PEGAWAI'] ?>"/></td>
                                        <td><? echo form_error('NAMA_PEGAWAI');?></td>
                                    </tr>
									<tr>
                                        <td width="80">Nama Panggilan</td>
                                        <td width="208"><input name="NAMA_PANGGILAN" type="text" size="50" value="<?= $value['NAMA_PANGGILAN'] ?>"/></td>
                                        <td><? echo form_error('NAMA_PANGGILAN');?></td>
                                    </tr>
									<tr>
                                        <td width="80">Tempat Lahir</td>
                                        <td width="208"><input name="TEMPAT_LAHIR" type="text" size="50" value="<?= $value['TEMPAT_LAHIR'] ?>"/></td>
                                        <td><? echo form_error('TEMPAT_LAHIR');?></td>
                                    </tr>
									<tr>
                                        <td width="80">Tanggal Lahir</td>
                                        <td width="108"><input id="TANGGAL_LAHIR" name="TANGGAL_LAHIR" readonly="true" size="20" value="<?= $value['TANGGAL_LAHIR'] ?>"/><input id="f_btn1" type="button" name="Submit22" value="" onclick="TANGGAL_LAHIR.value=''"/></td>
										<td><? echo form_error('TANGGAL_LAHIR');?></td>
									</tr>
									<tr>
                                        <td width="80">Golongan_Darah</td>
                                        <td width="208"><input name="GOLONGAN_DARAH" type="text" size="50" value="<?= $value['GOLONGAN_DARAH'] ?>"/></td>
                                        <td><? echo form_error('GOLONGAN_DARAH');?></td>
                                    </tr>
									<tr>
                                        <td width="80">Agama</td>
                                        <td width="208"><input name="AGAMA" type="text" size="50" value="<?= $value['AGAMA'] ?>"/></td>
                                        <td><? echo form_error('AGAMA');?></td>
                                    </tr>
									<tr>
                                        <td width="80">Suku</td>
                                        <td width="208"><input name="SUKU" type="text" size="50" value="<?= $value['SUKU'] ?>"/></td>
                                        <td><? echo form_error('SUKU');?></td>
                                    </tr>
									<tr>
                                        <td width="80">Bahasa Sehari-hari</td>
                                        <td width="208"><input name="BAHASA_SEHARI" type="text" size="50" value="<?= $value['BAHASA_SEHARI'] ?>"/></td>
                                        <td><? echo form_error('BAHASA_SEHARI');?></td>
                                    </tr>
                                    <tr>
                                        <td width="80">Departemen Pegawai</td>
                                        <td width="208"><input name="DEPARTEMEN_PEGAWAI" type="text" size="50" value="<?= $value['DEPARTEMEN_PEGAWAI'] ?>"/></td>
                                        <td><? echo form_error('DEPARTEMEN_PEGAWAI');?></td>
                                    </tr>
                                    <tr>
                                        <td width="80">Bengkel</td>
                                        <td width="208"><input name="BENGKEL" type="text" size="50" value="<?= $value['BENGKEL'] ?>"/></td>
                                        <td><? echo form_error('BENGKEL');?></td>
                                    </tr>
                                    <tr>
                                        <td width="80">Alamat</td>
                                        <td width="208"><input name="ALAMAT" type="text" size="50" value="<?= $value['ALAMAT'] ?>"/></td>
                                        <td><? echo form_error('ALAMAT');?></td>
                                    </tr>
                                    <tr>
                                        <td width="80">Telepon</td>
                                        <td width="208"><input name="TELEPON" type="text" size="50" value="<?= $value['TELEPON'] ?>"/></td>
                                        <td><? echo form_error('TELEPON');?></td>
                                    </tr>									
									<tr>
                                        <td width="80">Status</td>
										<td width="208">
										<?php 
											$pilihan_jk = array(
											Null => '-- Pilih Status --',
											'Aktif' => 'Aktif',
											'Tidak aktif' => 'Tidak aktif'
											);
											
											if ($status == "edit"){
											echo form_dropdown('STATUS',$pilihan_jk,$STATUS, 'class="field select"');
											}
											else {
											echo form_dropdown('STATUS',$pilihan_jk,  'class="field select"');
											}
										
										?>
										</td>
										<td><? echo form_error('STATUS');?></td>
									</tr>

                                    <?
                                    if ($status == "edit") {
                                        echo '
                                            <tr>
                                            <td width="80">&nbsp;</td>
                                            <td width="208"> <img src='.$FOTO_PEGAWAI.' width="150" height="150"></td>
                                            </tr>

                                            <tr>
                                            <td>Ganti foto</td>
                                            <td><input type="file" name="FOTO_PEGAWAI" size="30"/></td>
                                            <td></td>
                                            </tr>
                                        ';
                                    } else {
                                        echo'
                                        <tr>
                                        <td>Foto</td>
                                        <td><input type="file" name="FOTO_PEGAWAI" size="30"/></td>
                                        <td>'.form_error("FOTO_PEGAWAI").'</td>
                                        </tr>
                                        ';
                                    }
                                    ?>

                                    <tr>
                                        <td height="28">&nbsp;</td>
                                        <td>
                                            <div align="left">
                                                <input type="submit" name="Submit" value="Simpan" />
												<a href="<?php echo site_url('pegawai/index') ?>">
												<input type="button" value="Kembali" />
												</a>

												
											</div>
										</td>
                                    </tr>
                                </table>
                            </div>
                        </form>
                        <p align="center">&nbsp;</p></td></tr>
            </table>
        </div>
        <p>&nbsp;</p>
    </fieldset>
</div>
<p>
    <!--container-->
</p>
<p>&nbsp; </p>

        <p>&nbsp;</p>
		
		<script type="text/javascript">//<![CDATA[

      var cal = Calendar.setup({
          onSelect: function(cal) { cal.hide() }
      });
      cal.manageFields("f_btn1", "TANGGAL_LAHIR", "%Y-%m-%d");
    //]]></script>
		
    </fieldset>
</div>
<p>
    <!--container-->
</p>
<p>&nbsp; </p>


